{% import "header.html" as header %}

{{ header.notebookerHeader(readonly_mode, scheduler_disabled) }}

<html>
<head>
    <script type="application/javascript">
        var REPORT_NAME = "{{ report_name }}";
        var LIMIT = "{{ result_limit }}";
        var READONLY_MODE = "{{ readonly_mode|safe }}";
    </script>
    <script type="application/javascript" src="{{ url_for('static', filename='notebooker/result_listing.js') }}"></script>
</head>
<body>

    {{ header.sidebar(all_reports) }}
    <span id="failedLoad" style="display: none;">
        <h2>Couldn't load any reports!</h2>
        Either we haven't run any reports yet, or you don't have permission to view any on this Notebooker
        instance. Please check with the instance admin.
    </span>
    <div class="ui centered grid" style="display:none" id="indexTableContainer">
        <div class="twelve wide column">
            <h1 class="ui huge centered header">{{ titleised_report_name }} ({{ report_name }})</h1>
        </div>
        <div class="fifteen wide column">
            <table id="resultsTable" class="ui sortable selectable padded table">
            </table>
        </div>
        <div class="row">
            {% if n_results_available != result_limit and n_results_available > result_limit %}
            <div class="three wide column">
                <div>
                    <a class="ui button black" id="moreResultsButton" href="?limit={{ n_results_available }}">
                        Load all {{ n_results_available }} results
                    </a>
                </div>
            </div>
            {% endif %}
            {% if not readonly_mode %}
            <div class="three wide column">
                <a class="ui button green" id="runReportButton" href="/run_report/{{ report_name }}">
                    Manually run this report
                </a>
            </div>
            {% endif %}
        </div>
    </div>
        <div class="ui modal" id="deleteModal">
          <div class="header">Delete report</div>
          <div class="content">
            <p>Are you sure you wish to delete this report?</p>
          </div>
          <div class="actions">
            <div class="ui approve button red">Delete</div>
            <div class="ui cancel button">Cancel</div>
          </div>
        </div>
</body>
</html>
